import { DatabaseProvider } from "@/lib/db";
import { products } from "@supersavely/db/schema";

let _instance: ProductService;
class ProductService {
  private db: DatabaseProvider;
  constructor(db: DatabaseProvider) {
    this.db = db;
  }

  static getInstance(db: DatabaseProvider) {
    if (!_instance) {
      _instance = new ProductService(db);
    }
    return _instance;
  }
  getProducts() {
    return this.db.database.select().from(products).limit(10);
  }
}

export default ProductService;
